package com.csw.scala

object Demo07Extends {
  def main(args: Array[String]): Unit = {
    val b= new B("001","李四","男")
    println(b)
  }
  class A(id:String,name:String){
    println("A的默认构造函数")
    val _id=id
    val _name=name

    override def toString = s"A(${_id}, ${_name})"
  }

  /**
    *
    * 继承类同时调用构造函数
    */
  class B(id:String, name:String, gender:String) extends A (id,name){
    println("B的默认构造函数")
    val _gender = gender

    //重写父类的方法

    override def toString = s"A(${_id}, ${_name}, ${_gender})"
  }
}
